The code requires DYNARE, we used version 4.5.7. It also relies upon the folders Utilities and OPDSGE both available from 
https://sites.google.com/site/giovannilombardohomepage


The following procedures produces all the figures and tables in the code. 
By default, each procedure calls a MAT file which has already set up the results. 
The code can be recalculated by changing the line immediately below the comment "Recalculate Results" from "if 0" to "if 1". 
This switch will instruct the code to call DYNARE and recreate the MAT file with all the necessary results.

Generate_IRF_Results.m
Generate_Tables.m
Generate_Spillover_Results.m
Generate_Spillover_Results_IRBC.m

Run_Everything.m simply calls each of these procedures in turn.





In each procedure, there is a second switch, immediately below the comment "Generate the optimal files" 
which will recalculate the optimal policy files by calling OPDSGE. This requires several user updates to be done. 

First, the risk-sharing equation must be explicit when calculating the optimal policy:
cmk*(exp(Lambda_e)-exp(Lambda_c))+(1-cmk)*(exp(Lambda_e(+1))*exp(R_c)*exp(gamma_B*(Be-Be_ss))-1);

which must then be updated to search for the appropriate value of kappa_cmk in the mod file produced by the OPDSGE routine:
cmk*(Ce-Ce_ss-Cc+Cc_ss+kappa_cmk*auxepsi(+1)^2)+(1-cmk)*(exp(Lambda_e(+1))*exp(R_c)*exp(gamma_B*(Be-Be_ss))-1);

Secondly, the budget constraint:

exp(Ye)-exp(Ce)-exp(Itot_e)+cmk*(AD-exp(Lambda_e(+1))*AD(+1)+ffr*(-Be+exp(R_c(-1))*Be(-1)))
+(1-cmk)*(-Be+exp(R_c(-1))*Be(-1))
+ffr*(-(Dep)+exp(R_e(-1))*(Dep(-1))+(tau_k_e-1)*alphha*exp(Ye)+exp(Qe)*exp(Ie)+(1-thetta_e)*(exp(Ne)-deltta_T_e*exp(Qe)*exp(Ke(-1)))/thetta_e-deltta_T_e*exp(Qe)*exp(Ke(-1)));

must be replaced with an equation setting Arrow-Debreu securities to 0 when deriving the optimal policy:
AD=0; 

The budget constraint should be restored in the resultant mod file produced by OPSGE.

Finally, there is a section in GB_No_MaP_optimal_SDLT_steadystate.m which must be moved, which is clearly labelled in the output of the code.


